﻿using System;

using E.Enum;
using E.BLL;
using E.Model;
using E.Web.UI.Page;

using X.Common;

namespace E.Web.Teacher.internals.publics.course
{
    public partial class H : TeacherBasePage
    {
        protected override void ShowPage()
        {
            string act = XRequest.GetString("h");
            int id = XRequest.GetInt("id", -1);

            int rst = 0;
            string msg, href;

            if (id != -1)
            {
                switch (act)
                {
                    case "a":
                        rst = (new CourseBLL()).ActiveCourse(id);
                        break;
                    case "f":
                        rst = (new CourseBLL()).FreezeCourse(id);
                        break;
                    default: break;
                }

                if (rst > 0)
                {
                    msg = "操作成功";
                    href = "window.location.replace('/internals/publics/course/List.aspx');";
                }
                else
                {
                    msg = "操作失败";
                    href = "history.back();";
                }
            }
            else
            {
                msg = "参数错误";
                href = "history.back();";
            }
            ExecuteJS("alert('" + msg + "'); " + href);
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}